﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "  http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>这里是网站的标题 </title>
</head>
<body>
<div>
<?php

$user="admin";
$pass="admin";


if ($user=="" or $pass=="")
{
echo"你输入的信息有空,请<a href=\"login.php\">"."返回"."</a>重新输入";
}
else
{
mysqli_connect("localhost","root","")         /*请修改用户名和密码*/
or die("无法连接数据库，请重来");
mysqli_select_db("test")
or die("无法选择数据库，请重来");
mysqli_query("SET NAMES 'gbk'");/*解决汉字*/
$sql="SELECT use,pwd FROM admin where use = '".$user."' and pwd = '".$pass."'";
$query=mysqli_query($con,$sql);
if($row = mysqli_fetch_array($query,MYSQLI_ASSOC)){
echo $row['use']."&nbsp;".$row['pwd'];
}
}

?>

</div>
</body>
</html>
<!--
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>这里是网站的标题 </title>
</head>
<body>
<div>
-->
<?php
/*
$user=$_POST["user"];
$pass=$_POST["pass"];

if ($user=="" or $pass=="")
{
echo"你输入的信息有空,请<a href=\"login.php\">"."返回"."</a>重新输入";
}
else
{
mysqli_connect("localhost","root","") or die("无法连接数据库");
mysqli_select_db("test") or die("无法选择数据库");
mysqli_query("SET NAMES 'gbk'");
$row = mysql_fetch_array(mysqli_query(" SELECT use FROM admin where use = '$user' adn pwd = '$pass'"));
$mima=$row['password'];
if($pass == $mima)
{
session_start();
$_SESSION['yhm']=$user;
echo "<script>alert('成功登陆')</script>";
echo "<script>window.location.href='a.php';</script>";
}
else
{
echo"你的用户名或者密码输入错误,请<a href=\"login.php\">"."点这里返回"."</a>";
}
}
*/
?>
<!--
</div>
</body>
</html>-->
